package com.ruoyi.park.service.impl;

import com.ruoyi.omp.api.enums.LeaseStateEnum;
import com.ruoyi.park.domain.vo.RoomLeaseVO;
import com.ruoyi.park.mapper.BuiRoomLeaseMapper;
import com.ruoyi.park.service.IBuiRoomLeaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 房源租赁Service业务层处理
 *
 * @author cjie
 * @date 2021-07-20
 */
@Service
public class BuiRoomLeaseServiceImpl implements IBuiRoomLeaseService {
    @Autowired
    private BuiRoomLeaseMapper buiRoomLeaseMapper;

    /**
     * 查询房源租赁
     *
     * @param roomId 房源ID
     * @return 房源租赁
     */
    @Override
    public RoomLeaseVO selectRoomLeaseByRoomId(String roomId) {
        return buiRoomLeaseMapper.selectRoomLeaseByRoomId(roomId);
    }

    /**
     * 查询房源租赁列表
     *
     * @param roomLeaseVO 房源租赁
     * @return 房源租赁
     */
    @Override
    public List<RoomLeaseVO> selectBuiRoomLeaseList(RoomLeaseVO roomLeaseVO) {
        if(roomLeaseVO == null){
            roomLeaseVO = new RoomLeaseVO();
        }
        roomLeaseVO.setLeaseState(LeaseStateEnum.已租.getCode());
        return buiRoomLeaseMapper.selectBuiRoomLeaseList(roomLeaseVO);
    }
}
